/*
 * @Author: yudun yudun@idata.ah.cn
 * @Date: 2025-09-28 11:28:07
 * @LastEditors: yudun yudun@idata.ah.cn
 * @LastEditTime: 2025-09-28 12:12:52
 * @FilePath: \trae-code\spzx-admin\src\stores\counter.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', {
  state: () => ({
    count: 0,
    name: 'Counter Store'
  }),
  
  getters: {
    doubleCount: (state) => state.count * 2,
    getCountWithMessage: (state) => (message: string) => `${message}: ${state.count}`
  },
  
  actions: {
    increment() {
      this.count++
    },
    decrement() {
      this.count--
    },
    reset() {
      this.count = 0
    },
    incrementBy(amount: number) {
      this.count += amount
    }
  }
})